<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Document</title>
    </head>
    <body>
        


        <script>
            // 定义一个变量接收值
            var sum = 0
            // 循环找出1到100的数字
            for(var i = 1;i <=100;i++){
                // 奇数加 偶数减
                if(i % 2 !==0){
                    sum +=1/i
                }else{
                    sum -=1/i
                }
            }
            console.log(sum);
            alert(sum)
            
        </script>
    </body>
    </html>
</body>
</html>